package com.file.system.entity.system;


import com.file.system.plugin.validated.SQLInjectionValidation;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.validation.groups.Default;
import java.io.Serializable;


/**
 * 数据权限关联树节点
 *
 * @author jch、
 */
@Data
@Accessors(chain = true)
public class WebRoleNode implements Serializable {

    private static final long serialVersionUID = 1L;


    //新增
    public interface add extends Default {
    }

    //修改
    public interface update extends Default {
    }

    /**
     * id
     */
    @NotNull(groups = {update.class}, message = "id不能为空")
    @Min(value = 1, message = "id长度最小1")
    private Long id;
    /**
     * 数据权限编码
     */
    @NotEmpty(groups = {update.class, add.class}, message = "数据权限编码不能为空")
    @Size(min = 1, max = 100, message = "数据权限编码长度1-100")
    @SQLInjectionValidation(fieldName = "数据权限编码")
    private String code;
    /**
     * 角色id
     */
    @NotNull(groups = {add.class, update.class}, message = "角色id不能为空")
    @Min(value = 1, message = "角色id最小1")
    private Long fkRoleId;
    /**
     * 树节点编码
     */
    @NotNull(groups = {add.class, update.class}, message = "树节点编码不能为空")
    @Min(value = 1, message = "树节点编码最小1")
    private Long fkNodeId;
}
